package hyj.qx.websocket.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import hyj.qx.websocket.entity.Content;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ContentMapper extends BaseMapper<Content> {
    @Select("<script>" +
            "SELECT * FROM content " +
            "WHERE (from_id = #{fromId} AND to_id = #{toId}) " +
            "   OR (from_id = #{toId} AND to_id = #{fromId}) " +
            "ORDER BY create_time ASC" +
            "</script>")
    List<Content> getContents(@Param("fromId") Integer fromId, @Param("toId") Integer toId);
}
